package net.topcrazy.blog.service.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import net.topcrazy.blog.dao.TsysMenuDAO;
import net.topcrazy.blog.pojo.dto.TsysMenuDto;
import net.topcrazy.blog.service.TsysMenuService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 业务对象：TsysMenuServiceImpl，此对象应实现对应业务接口TsysMenuService的所有方法。
 * 创建日期：2012年09月23日11时01分
 * 
 * @author BoyoiFramework
 */
@Service
public class TsysMenuServiceImpl implements TsysMenuService
{
	@Autowired
	private TsysMenuDAO dao;

	public List<TsysMenuDto> loadMenu(String accoountId) throws Exception
	{
		List<TsysMenuDto> dtoList = new ArrayList<TsysMenuDto>();
		List<Map<String, Object>> result = dao.loadMenuByAccountId(accoountId);
		if (result != null && !result.isEmpty())
		{
			for (Map<String, Object> map : result)
			{
				TsysMenuDto dto = new TsysMenuDto();
				dto.setMenuId(dao.getTT().getStringFromMap(map, "menuId"));
				dto.setMenuName(dao.getTT().getStringFromMap(map, "menuName"));
				dto.setIcon(dao.getTT().getStringFromMap(map, "icon"));
				dtoList.add(dto);

			}
		}
		return dtoList;
	}

}
